When running this code, I get "trottle queue is over max capacity" error and I dont know how to get this to work.
The function that gets called for the service itself is an async function call to a 3rd party API. I could not find any implementation that works for my example and hope to find someone to explain me what is happening here.
Thank you
async analyze() {
const markets = Object.values(this.service.getMarkets()).filter(
(m) => this.markets.includes(m.quoteId) && m.active
);
const tasks = [];
for (let i = 0; i < markets.length; i++) {
//market iteration
const symbol = markets[i].symbol;
for (let j = 0; j < this.timeframes.length; j++) {
//timeframe iteration
const timeframe = this.timeframes[j];
tasks.push(this.service.getOHLCV(symbol, timeframe));
}
}
console.log("Tasks to be executed", tasks.length);
const startTime = Date.now();
const ohlcvDatasets = await Promise.all(tasks);
const endTime = Date.now() - startTime;
console.log(`executed ${tasks.length} tasks in ${endTime} ms`);
this.analyzeRSI(ohlcvDatasets);
}
this.service.getOHLCV() returns a Promise. The function in the service class makes use of a 3rd party library which calls an external API.
Like so.
getOHLCV(){ return 3rdPartyAPICall }